import React, { useEffect } from 'react'
import { useParams } from 'react-router-dom'
import { useDispatch, useSelector } from 'react-redux';
import { GETDETILE, ALLSTATE } from "../../type/store.d"
export default function Detail() {
  const dspatch = useDispatch()
  const params = useParams()
  console.log(params);
  useEffect(() => {
    dspatch({
      type: GETDETILE,
      payload: params.id
    })
  }, [])
  const detileData = useSelector((state: ALLSTATE) => {
    return state.detileData
  })
  return (
    <div>
        <h3>{detileData.title}</h3>
        <p>{detileData.wrod}</p>
    </div>
  )
}
